<?php
/**
 * This is areas/admin_edit template file. 
 *
 * @copyright     Copyright 2008-2010, LilCake.net
 * @link          http://lilcake.net LilCake.net
 * @package       lil
 * @subpackage    lil.views.areas
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
	$area_edit = array(
		'title_for_layout' => 
			($this->Form->value('Area.id') ? __d('lil', 'Edit Area') : __d('lil', 'Add an Area')),
		'form' => array(
			'pre' => '<div class="form">',
			'post' => '</div>',
			'lines' => array(
				'form_start' => array(
					'class'      => $this->LilForm,
					'method'     => 'create',
					'parameters' => array('model' => 'Area')
				),
				'id' => array(
					'class' => $this->LilForm,
					'method' => 'input',
					'parameters' => array(
						'id',
						'options' => array('type' => 'hidden')
					)
				),
				'referer' => array(
					'class' => $this->LilForm,
					'method' => 'input',
					'parameters' => array(
						'referer',
						'options' => array('type' => 'hidden')
					)
				),
				
				'fieldset_a1' => sprintf('<fieldset><legend>%s</legend>', __d('lil', 'Basic data')),
				'name' => array(
					'class'      => $this->LilForm,
					'method'     => 'input',
					'parameters' => array(
						'field'   => Configure::read('Lil.areaDisplayField'),
						'options' => array(
							'label' => __d('lil', 'Name') . ':',
							'error' => __d('lil', 'Area name is required.'),
							'class' => 'big'
						)
					)
				),
				Configure::read('Lil.areaSlugField') => 
					(Configure::read('Lil.areaSlug') != 'manual') ? array() :
					array(
						'class'      => $this->LilForm,
						'method'     => 'input',
						'parameters' => array(
							'field'   => Configure::read('Lil.areaSlugField'),
							'options' => array(
								'label' => __d('lil', 'Slug') . ':',
								'error' => __d('lil', 'Slug must only use letters, numbers, underscores or hyphens.'),
							)
						)
					),
				'description' => array(
					'class'      => $this->LilForm,
					'method'     => 'input',
					'parameters' => array(
						'field'   => Configure::read('Lil.areaDescriptionField'),
						'options' => array(
							'label' => __d('lil', 'Description') . ':',
							'error' => __d('lil', 'Area description is required.'),
						)
					)
				),
				'user' => empty($users) ? null : array(
					'class'      => $this->LilForm,
					'method'     => 'input',
					'parameters' => array(
						'field'   => 'User',
						'options' => array(
							'label' => __d('lil', 'User') . ':',
						)
					)
				),
				'fieldset_a2' => '</fieldset>',
				
				'submit' => array(
					'class'      => $this->LilForm,
					'method'     => 'submit',
					'parameters' => array(
						'label' => __d('lil', 'Save')
					)
				),
				'form_end' => array(
					'class'      => $this->LilForm,
					'method'     => 'end',
					'parameters' => array()
				),
			)
		)
	);
	
	if ($this->Form->value('Area.id')) {
		$area_edit = $this->callPluginHandlers('form_edit_area', $area_edit);
	} else {
		$area_edit = $this->callPluginHandlers('form_add_area', $area_edit);
	}
	
	$this->Lil->form($area_edit);